<?php
/**
 * Created by PhpStorm.
 * User: sunzexin
 * Date: 2018/1/21
 * Time: 11:10
 */

namespace App\Http\Logics\Admin;

use App\Http\Logics\BaseLogic;
use App\Order;

class OrderLogic extends BaseLogic
{
    public static function getOrderList($data)
    {
        $query = Order::with(['user', 'goods'])->orderBy('created_at', 'desc');
        $order = $data['limit'] ? $query->paginate($data['limit']) : $query->get();
        if (empty($order)){
            return self::response(self::CONTENT_IS_EMPTY);
        }
        $order->map(function ($order) {
            return $order->append('status_text');
        });
        return self::response(self::SUCCESS, $order);
    }
}